import request from '@/utils/request'

export const getCaptcha = (data) => {
  return request({
    url: '/sys/captcha',
    method: 'post',
    data
  })
}
export const loginUser = (data) => {
  return request({
    url: '/sys/login',
    method: 'post',
    data
  })
}

export const getUserInfo = () => {
  return request({
    url: '/user/profile',
    method: 'get'
  })
}

export const registerUser = (data) => {
  return request({
    url: '/sys/register',
    method: 'post',
    data
  })
}

export const editUserInfo = (data) => {
  return request({
    url: '/user/profile',
    method: 'put',
    data
  })
}

export const getSts = () => {
  return request({
    url: '/user/sts',
    method: 'get'
  })
}

/**
 * 微信登录前置数据获取
 */
export const getWXLoginData = () => {
  return request({
    url: '/sys/wxlogin/data'
  })
}

/**
 * 获取微信登录的 access_token
 */
export const getWXLoginToken = (params) => {
  return request({
    url: '/sys/wxlogin/access_token',
    params
  })
}

/**
 * 获取微信登录的 用户数据
 */
export const getWXLoginUserInfo = (params) => {
  return request({
    url: '/sys/wxlogin/userinfo',
   params
  })
}
